// -------------------------------------------------
// BlinKit - BlinKit Library
// -------------------------------------------------
//   File Name: StyleColor.cpp
// Description: StyleColor Class
//      Author: Ziming Li
//     Created: 2022-05-21
// -------------------------------------------------
// Copyright (C) 2022 MingYang Software Technology.
// -------------------------------------------------

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "./StyleColor.h"

#include "blinkit/blink/renderer/core/layout/layout_theme.h"

namespace blink {

Color StyleColor::colorFromKeyword(CSSValueID keyword)
{
    if (const char* valueName = getValueName(keyword)) {
        if (const NamedColor* namedColor = findColor(valueName, strlen(valueName)))
            return Color(namedColor->ARGBValue);
    }
    return LayoutTheme::theme().systemColor(keyword);
}

} // namespace blink
